Skip to content

Conversation

LucaButBoring
Copy link
Contributor

@LucaButBoring LucaButBoring commented Jun 19, 2025

Adds optional size property to the Resource type, which was added to the spec in 2025-03-26. Also adds a Resource builder class to avoid needing to add more constructors in the future.

Motivation and Context

Missing spec-defined feature.

How Has This Been Tested?

Unit tests

Breaking Changes

None, added a backwards-compatible ctor to avoid a breaking change. Also implemented a builder to avoid needing to do this in the future.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Closes #330

@tzolov
Copy link
Contributor

tzolov commented Jun 23, 2025

Thank you @LucaButBoring , It looks good.
Perhaps we can add validation to ensure that the compulsory fields uri and name are not empty.

@tzolov tzolov self-assigned this Jun 23, 2025
@tzolov tzolov added this to the 0.11.0 milestone Jun 23, 2025
@LucaButBoring
Copy link
Contributor Author

Updated

tzolov pushed a commit that referenced this pull request Jun 24, 2025
The size field helps hosts display file sizes and estimate context window usage.

- Add size parameter to Resource record for tracking raw content size in bytes
- Implement Builder pattern for Resource construction with validation
- Add deprecated constructor for backwards compatibility
- Add tests for builder pattern and field validation

Resolves #330

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov
Copy link
Contributor

tzolov commented Jun 24, 2025

Thanks @LucaButBoring ,
Rebased, squashed, adjusted and merged at 6c330db

@tzolov tzolov closed this Jun 24, 2025
@tzolov tzolov mentioned this pull request Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support optional resource sizes

2 participants